/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ssi.mrms.service.Impl;

import com.ssi.mrms.dao.ManageProjectDao;
import com.ssi.mrms.dao.RoomProfileDao;
import com.ssi.mrms.model.DataTableModel;
import com.ssi.mrms.model.RMcsdtlModel;
import com.ssi.mrms.model.RMrmlstModel;
import com.ssi.mrms.model.RMrmownModel;
import com.ssi.mrms.model.RMrmtntModel;
import com.ssi.mrms.service.RoomProfileService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author jirapatjantsakool
 */
@Service("RoomProfileService")
@Transactional(readOnly = false)
public class RoomProfileServiceImpl implements RoomProfileService {
    
    @Autowired RoomProfileDao dao;

    @Override
    public RMrmlstModel getRoomProfileByAddress(RMrmlstModel model) {
       return dao.findRoomProfileByAddress(model);
    }

    @Override
    public List<RMrmlstModel> getRoomProfileByCriteria(RMrmlstModel model) {
        return dao.findRoomProfileByCriteria(model);
    }

    @Override
    public void save(RMrmlstModel model) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public boolean update(RMrmlstModel model) throws Exception {
    	dao.update( model.getOwnModel());
    	
    	dao.update(model.getTntModel());
    	
    	return true;
//    	return dao.update( model.getOwnModel()) && ;
    }

    @Override
    public boolean delete(RMrmlstModel model) throws Exception {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public DataTableModel<RMrmlstModel> getCarStickerDataTable(RMrmlstModel model, int iDisplayStart, int iDisplayLength) {
        return dao.findDataTable(model, iDisplayStart, iDisplayLength);
    }

    @Override
    public RMrmlstModel getRoomProfileById(Integer rlrmid) {
        return dao.findRoomProfileById(rlrmid);
    }
    
}
